/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.servlet;

import com.qdu.dao.JournalDao;
import com.qdu.dao.impl.JournalDaoImpl;
import com.qdu.entity.Journal;
import com.qdu.entity.User;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Lenovo
 */
@WebServlet("/smjoi")
public class SearchMyJournalOnIndex extends HttpServlet{
    JournalDao journalDao = new JournalDaoImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       
        User user=new User();
        HttpSession session=req.getSession();
        user=(User)session.getAttribute("user");
        int id=user.getId();
        System.out.println("my servlet当前登录id："+id);
        
        List<Journal> list=journalDao.getMyJournalOnIndex(id);
        req.setAttribute("mjoiList", list);
        req.getRequestDispatcher("/journalIndex2.jsp").forward(req, resp);
    }
    
}
